﻿// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
// TRANSFORM_TEX(v.uv, _MainTex): v.uv * _MainTex_ST.xy + _MainTex_ST.zw
// multi_compile_fwdadd: multi_compile DIRECTIONAL DIRECTIONAL_COOKIE POINT POINT_COOKIE SPOT

Shader "Custom/Project8/AlphaShader"
{
	Properties {
		_Tint ("Tint", Color) = (1, 1, 1, 1)
		_MainTex ("Albedo", 2D) = "white" {}
		
		[NoScaleOffset] _NormalMap ("NormalMap", 2D) = "bump" {}
		_BumpScale ("BumpScale", Range(0, 1)) = 1
		
		[NoScaleOffset] _MetallicMap ("Metallic", 2D) = "white" {}
		[Gamma] _Metallic ("Metallic", Range(0, 1)) = 0
		_Smoothness ("Smoothness", Range(0, 1)) = 0.5
		
		_DetailTex ("Detail Albedo", 2D) = "gray" {}
		[NoScaleOffset] _DetailNormalMap ("DetailNormalMap", 2D) = "bump" {}
		_DetailBumpScale ("DetailBumpScale", Range(0, 1)) = 1
		
		[NoScaleOffset] _EmissionMap ("Emission", 2D) = "black" {}
		_Emission ("Emission", Color) = (0, 0, 0)
		
		_AlphaCutoff ("Alpha Cutoff", Range(0, 1)) = 0.5
		
		[HideInInspector] _SrcBlend ("_SrcBlend", Float) = 1
		[HideInInspector] _DstBlend ("_DstBlend", Float) = 0
		[HideInInspector] _ZWrite ("_ZWrite", Float) = 1
	}
	
	CGINCLUDE
	
	#define BINORMAL_PER_FRAGMENT
	
	ENDCG
	
	SubShader 
	{
		Pass
		{
			Tags
			{
				"LightMode" = "ForwardBase"
			}
			
			Blend [_SrcBlend] [_DstBlend]
			ZWrite [_ZWrite]
			
			CGPROGRAM
			
				#pragma target 3.0
								
				#pragma multi_compile _ VERTEXLIGHT_ON
								
				#pragma shader_feature _ _RENDERING_CUTOUT _RENDERING_FADE _RENDERING_TRANSPARENT
				#pragma shader_feature _ _METALLIC_MAP
				#pragma shader_feature _ _SMOOTHNESS_ALBEDO _SMOOTHNESS_METALLIC
				#pragma shader_feature _ _EMISSION_MAP

				#pragma vertex MyVertexProgram
				#pragma fragment MyFragmentProgram
				
				#define FORWARD_BASE_PASS
				
				#include "LightingLib.cginc"
				
			ENDCG
		}
		Pass
		{
			Tags
			{
				"LightMode" = "ForwardAdd"
			}
			
			Blend [_SrcBlend] One
			ZWrite Off
			
			CGPROGRAM
			
				#pragma target 3.0
				
				#pragma multi_compile_fwdadd
				
				#pragma shader_feature _ _RENDERING_CUTOUT _RENDERING_FADE _RENDERING_TRANSPARENT
				#pragma shader_feature _ _METALLIC_MAP
				#pragma shader_feature _ _SMOOTHNESS_ALBEDO _SMOOTHNESS_METALLIC
								
				#pragma vertex MyVertexProgram
				#pragma fragment MyFragmentProgram
				
				#include "LightingLib.cginc"
				
			ENDCG
		}
	}
	
	CustomEditor "AlphaShaderGUI"
}















